Systems, methods, and media for outputting data based upon anomaly detection

ABSTRACT

Systems, methods, and media for outputting data based on anomaly detection are provided. In some embodiments, methods for outputting data based on anomaly detection include: receiving a known-good dataset; storing distinct n-grams from the known-good dataset to form a binary anomaly detection model; receiving known-good new n-grams; computing a rate of receipt of distinct n-grams in the new n-grams; determining whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; using the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Applications No. 60/778,008, filed Feb. 28, 2006, and U.S. Provisional Patent Application No. 60/790,626, filed Apr. 10, 2006, each of which is hereby incorporated by reference herein in its entirety.

STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT

The government may have certain rights in the present invention pursuant to grants by the Army Research Office, Grant No. ARO W911NF-04-1-0442.

TECHNICAL FIELD

The disclosed subject matter relates to systems, methods, and media for outputting data based on anomaly detection.

BACKGROUND

Content anomaly detectors have been developed to identify anomalous data in an otherwise seemingly normal stream of data. Anomalous data can include instances of malicious code such as worms, viruses, Trojans, etc. In some of these detectors, an n-gram is looked at by the detector to determine if it is anomalous. An n-gram is a set of n units of data. For example, a 1-gram may be a single byte of data, and a 2-gram may be two bytes of data.

A content anomaly detection model based on 1-gram frequency distribution of datasets is effective at capturing attacks that display abnormal byte distributions, but it is vulnerable to attacks crafted to resemble normal byte distributions. A content anomaly detection model based on higher order n-grams frequency distribution of datasets can address this shortcoming. However, as the order of the n-grams increases, memory usage increases exponentially. This is because the maximum possible number of distinct n-grams increases exponentially as the order of the n-grams increases. For example, the maximum possible number of distinct 5-grams is 256⁵, or 1024 billion.

As new defensive (e.g., anomaly detection, etc.) techniques are developed to counter fast-spreading network threats, attackers have become more sophisticated as well. A model based on a mixture of high order n-grams frequency distribution can address threats posed by such sophisticated attackers, but only at the expense of heavy memory and computational overhead. For example, even for a small mixture of n-grams of modest orders, such as a mixture of 2-grams, 3-grams, and 4-grams, the total memory capacity may be impracticable.

SUMMARY

Systems, methods, and media for outputting data based on anomaly detection are provided. In some embodiments, methods for outputting data based on anomaly detection include: receiving a known-good dataset; storing distinct n-grams from the known-good dataset to form a binary anomaly detection model; receiving known-good new n-grams; computing a rate of receipt of distinct n-grams in the new n-grams; determining whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; using the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, methods for outputting data based on anomaly detection include: receiving known anomaly signatures; generating n-grams of different sizes using the known anomaly signatures; storing abnormal n-grams in the n-grams of different sizes in a binary anomaly detection model; using the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, methods for outputting data based on anomaly detection include: receiving a shared binary anomaly detection model; comparing the shared binary anomaly detection model with a local anomaly detection model; combining the shared binary anomaly detection model with the local anomaly detection model to form a new binary anomaly detection model; using the model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, methods for outputting data based on anomaly detection include: receiving an input dataset; generating n-grams of different sizes from the input dataset; counting the number of distinct n-grams in the n-grams of different sizes that are not present in a binary anomaly detection model; computing an anomaly score based upon the number of distinct n-grams and a total count of the n-grams in the input dataset; using the anomaly score to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, methods for outputting data based on anomaly detection include: receive an input dataset; using a binary anomaly detection model to determine whether an input dataset is likely to contain an anomaly; if the input dataset is determined to be likely to contain an anomaly, dropping the input dataset; and if the input dataset is determined to be unlikely to contain an anomaly, outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, computer-readable media containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, are provided. This method includes: receiving a known-good dataset; storing distinct n-grams from the known-good dataset to form a binary anomaly detection model; receiving known-good new n-grams; computing a rate of receipt of distinct n-grams in the new n-grams; determining whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; using the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, computer-readable media containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, are provided. This method includes: receiving known anomaly signatures; generating n-grams of different sizes using the known anomaly signatures; storing abnormal n-grams in the n-grams of different sizes in a binary anomaly detection model; using the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, computer-readable media containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, are provided. This method includes: receiving a shared binary anomaly detection model; comparing the shared binary anomaly detection model with a local anomaly detection model; combining the shared binary anomaly detection model with the local anomaly detection model to form a new binary anomaly detection model; using the model to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, computer-readable media containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, are provided. This method includes: receiving an input dataset; generating n-grams of different sizes from the input dataset; counting the number of distinct n-grams in the n-grams of different sizes that are not present in a binary anomaly detection model; computing an anomaly score based upon the number of distinct n-grams and a total count of the n-grams in the input dataset; using the anomaly score to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, computer-readable media containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, are provided. This method includes: receive an input dataset; using a binary anomaly detection model to determine whether an input dataset is likely to contain an anomaly; if the input dataset is determined to be likely to contain an anomaly, dropping the input dataset; and if the input dataset is determined to be unlikely to contain an anomaly, outputting the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, systems for outputting data based on anomaly detection are provided. The systems include a digital processing device that: receives a known-good dataset; stores distinct n-grams from the known-good dataset to form a binary anomaly detection model; receives known-good new n-grams; computes a rate of receipt of distinct n-grams in the new n-grams; determines whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; uses the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputs the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, systems for outputting data based on anomaly detection are provided. The systems include a digital processing device that: receives known anomaly signatures; generates n-grams of different sizes using the known anomaly signatures; stores abnormal n-grams in the n-grams of different sizes in a binary anomaly detection model; uses the binary anomaly detection model to determine whether an input dataset contains an anomaly; and outputs the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, systems for outputting data based on anomaly detection are provided. The systems include a digital processing device that: receives a shared binary anomaly detection model; compares the shared binary anomaly detection model with a local anomaly detection model; combines the shared binary anomaly detection model with the local anomaly detection model to form a new binary anomaly detection model; uses the model to determine whether an input dataset contains an anomaly; and outputs the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, systems for outputting data based on anomaly detection are provided. The systems include a digital processing device that: receives an input dataset; generates n-grams of different sizes from the input dataset; counts the number of distinct n-grams in the n-grams of different sizes that are not present in a binary anomaly detection model; computes an anomaly score based upon the number of distinct n-grams and a total count of the n-grams in the input dataset; uses the anomaly score to determine whether an input dataset contains an anomaly; and outputs the input dataset based on whether the input dataset contains an anomaly.

In some embodiments, systems for outputting data based on anomaly detection are provided. The systems include a digital processing device that: receives an input dataset; uses a binary anomaly detection model to determine whether an input dataset is likely to contain an anomaly; if the input dataset is determined to be likely to contain an anomaly, drops the input dataset; and if the input dataset is determined to be unlikely to contain an anomaly, outputs the input dataset based on whether the input dataset contains an anomaly.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of a system for generating, training, and sharing a binary-based content anomaly model and for using the content anomaly model to detect content anomalies in accordance with some embodiments of the disclosed subject matter.

FIG. 2 is a simple illustration of a method for generating, training, and sharing a binary-based content anomaly detection model and for using the content anomaly model to detect content anomalies in accordance with some embodiments of the disclosed subject matter.

FIG. 3 is a simple illustration of a method for generating and training a binary-based content anomaly detection model using known-good training datasets in accordance with some embodiments of the disclosed subject matter.

FIG. 4 is a simple illustration of a method for generating and training a binary-based content anomaly detection model using known anomaly signatures in accordance with some embodiments of the disclosed subject matter.

FIG. 5 is a simple illustration of a method for sharing binary-based content anomaly detection models in accordance with some embodiments of the disclosed subject matter.

FIG. 6 is a simple illustration of a method for using binary-based content anomaly detection models to detect content anomalies in accordance with some embodiments of the disclosed subject matter.

FIG. 7 is a simple illustration of a method for training a content anomaly detection model and using the model to detect content anomalies in accordance with some embodiments of the disclosed subject matter.

DETAILED DESCRIPTION

Systems, methods, and media for outputting data based on anomaly detection are provided. In some embodiments of the disclosed subject matter, systems, methods, and media are provided for generating and/or training binary-based content anomaly detection models. The presence and/or absence of each of the distinct n-grams in a training dataset can be used to generate the detection models. For instance, a detection model can be generated using a set of n-grams in a training dataset that are observed during a training phase of the model. The model can be referenced during a detecting or testing phase to detect the payload of a data packet containing one or more never-before-seen n-grams.

In some embodiments of the disclosed subject matter, systems, methods, and media are provided for generating and updating an anomaly signature model. A binary-based content anomaly detection model has advantages in speed and memory efficiency, but it can be sensitive to noisy training datasets (i.e., training datasets that are not totally free of malicious code). An anomaly signature model containing a collection of signatures of known malicious code can be used to compensate for the risk of using corrupted training datasets that are associated with binary-based content anomaly detection models. For example, the signature content of samples of known malicious code can be used to build and update an anomaly signature model that can be used as a reference. For instance, such an anomaly signature model can be used to filter out malicious code from training datasets.

In some embodiments of the disclosed subject matter, systems, methods, and media are provided for sharing binary-based content anomaly detection models and anomaly signature models. A group of protected sites facing similar network security threats can share their models for enhancing the common defense against such threats. For example, the binary-based content anomaly detection model of each site in the group can be shared regularly to identify suspicious content commonly detected by multiple sites.

In some embodiments of the disclosed subject matter, systems, methods, and media are provided for creating and using a feedback loop between a binary-based content anomaly detector and a host-based detector. Interactions between a host-based detector and a binary-based detector can be developed over time. For example, a host-based detector can further examine a dataset suspected by a binary-based detector of containing malicious code and either confirm or correct the suspicion, thereby reducing the false-positive rate of the detector. The binary-based detector, in turn, can reduce the volume of the network traffic directed to the host-based detector, thereby reducing the overhead associated with running the host-based detector.

FIG. 1 is a schematic diagram of a system 100 for detecting content anomalies in accordance with some embodiments. As illustrated, system 100 can include a network 102, data traffic 104, a detector 106, a data structure 108, a production server 110, a shadow server 112, a host-based detector 114, and a high-entropy-gram (HEG) analyzer 116. In some embodiments, detector 106, data structure 108, production server 110, shadow server 112, host-based detector 114, and HEG analyzer 116 can be implemented in a single device or a combination of devices. These device(s) can includes various suitable mechanisms for performing the functions associated with detector 106, data structure 108, production server 110, shadow server 112, host-based detector 114, and HEG analyzer 116. For example, such mechanisms can include a processor, digital processing device, memory, communications interfaces, displays, etc., such a general purpose computer, a special purpose computer, a server, a mobile phone, a personal data assistant, an email device, and/or various other suitable devices.

Network 102 can be a local area network (LAN), a wide area network (WAN), a wireless network, the Internet, a cable television network, a telephone network, and/or various other suitable networks from which malicious attacks can be launched.

Data traffic 104 can include one or more network data packets, data frames, one or more files that contain various types of data, such as text, graphic images, sound samples, video samples, and computer-executable codes, a stream of data in bytes or a stream of various other suitable symbols or tokens in one or more communication sessions, and/or various other forms of data in suitable formats.

In some embodiments, n-grams can be generated in detector 106 by sliding windows of arbitrary lengths over data traffic 104. Detector 106 can train a content anomaly detection model by storing the distinct n-grams observed during a training phase in data structure 108.

During a detection phase, detector 106 can score data traffic 104 on the basis of the number of never-before-seen n-grams contained in data traffic 104. The score can also be weighted by the number of malicious n-grams contained in data traffic 104. Detector 106 can capture the order dependence of byte sequences in data traffic 104 by modeling higher order n-grams. This can enable detector 106 to capture more sophisticated attacks.

Data structure 108 can be a data structure that allows for the modeling of a mixture of different sizes of n-grams. Data structure 108 may be implemented in random access memory (RAM), flash memory, a disk drive, optical media, and/or various other suitable storage technologies. In some embodiments, Bloom filters are used.

A Bloom filter can be defined as a bit array of m bits, where any individual bit is set if the hash of an input value (i.e., input value mod m) is i. A Bloom filter can act as a one-way data structure that can contain many items. An advantage of using a Bloom filter is that operations on a Bloom filter takes a constant amount of time regardless of the size of the Bloom filter, keeping computational overhead low. In some embodiments, the H3 hash function or SHA-1 hash function may be used in connection with a Bloom filter, although other hash functions may additionally or alternatively be used.

A Bloom filter may contain false positives if a collision occurs while performing a check operation. Collisions may occur because two distinct inputs into a hash function may produce identical outputs. Suppose, for example, that there are two distinct n-grams, A (which occurs in the training dataset only) and B (which occurs in the input dataset only), which both produce the same hash value. Because A is in the training dataset, the Bloom filter contains a bit set for A. If the Bloom filter is checked for B, however, because B hashes to the same value, then B can be mistakenly believed to be represented in the Bloom filter. This is a false positive.

Production server 110 and shadow server 112 can be used to run application programs that ultimately use data traffic 104. In some embodiments, detector 106 directs data traffic 104 to production server 110 when detector 106 determines that it is unlikely that data traffic 104 contains malicious code. In some embodiments, shadow server 112 and production server 110 can be configured to have the same software programs running, except that shadow server 112 can be operating in a protected environment using an emulator, virtual machine, sandbox or other suitable mechanism for protecting server 112 from potentially malicious code. In some embodiments, server 112 includes host-based detector 114 which can additionally or alternatively provide a protected environment using an emulator, virtual machine, sandbox or other suitable mechanism for protecting server 112 and detector 114 from potentially malicious code. Server 112 and/or host-based detector 114 can include one or more host-based fault detectors and patch generation techniques, such as StackGuard/MemGuard, Selective Transactional Emulator (STEM), and Dynamic Buffer Overflow Containment (DYBOC), and anti-virus scanners that can collect and maintain content anomaly signatures of malicious code, such as stealthy worms, etc. StackGuard and MemGuard can be obtained from “http://www.freebsd.com.” STEM is discussed in detail in Building a Reactive Immune System for Software Services by Stelios Sidiroglou-Douskos, et al. DYBOC is discussed in detail in A Dynamic Mechanism for Recovering from Buffer Overflow Attacks by Stelios Sidiroglou-Douskos, et al.

In some instances, data traffic 104 that is directed to shadow server 112 may be falsely identified as containing an anomaly. Using host based detector 114, shadow server 112 may validate the data as not containing an instance of malicious code. Detector 106 and shadow server 112 can interact so that false positives that have been validated by shadow server 112 serve as training data to improve the accuracy of the content anomaly detection model of detector 106. Through this process, the false positive rate of detector 106 can decrease. This, in turn, can result in workload reduction for shadow server 112.

In some embodiments, shadow server 112 acts as a training supervisor, wherein server requests are sent to shadow server 112 and only those requests that generate a normal response are sent to detector 106 for training the content anomaly detection model of detector 106.

In some embodiments, detector 106 is deployed with no trained model and, instead it initially deems 100% of data traffic 104 as containing malicious requests. Shadow server 112 can then provide false-positive feedback and relevant training data to detector 106 for incremental training.

High-entropy-gram (HEG) analyzer 116 can be used to detect HEG grams and analyze scarcity of commonly occurring HEGs and HEG distributions of normal and malicious data. An HEG is a type of gram that has a high level (e.g., 98-100%) of its contents as distinct byte values. Using HEG grams can help reduce the amount of data that a Bloom filter must contain. This can be accomplished by making Bloom filters to contain non-HEG grams, such as data between commonly occurring HEGs.

HEG analyzer 116 can be a separate device running one or more analyzer programs. It can also be one or more programs run by detector 106.

FIG. 2 is a simple illustration of a method for generating, training, and sharing a binary-based content anomaly model and for using the content anomaly model to detect content anomalies in accordance with some embodiments. As shown at 202, a binary-based content anomaly detection model is generated and trained. In some embodiments, a binary-based content anomaly detection model is generated and trained using known good training datasets, for example, as described in connection with FIG. 3. In some embodiments, a binary-based content anomaly detection model is generated and trained using known anomaly signatures, for example, as described in connection with FIG. 4. In some embodiments, a binary-based content anomaly detection model is trained in cooperation with a host-based detector, for example, as described in connection with part 703 of FIG. 7.

At 204, the binary-based content anomaly detection model is shared. In some embodiments, a binary-based content anomaly detection model is received from one or more remote sites to compare with and update the local model, for example, as described in connection with FIG. 5.

At 206, the binary-based content anomaly detection model is used to detect content anomalies. In some embodiments, an anomaly score of an input dataset is used to determine whether the input dataset is anomalous, for example, as described in connection with FIG. 6. In some embodiments, a binary-based content anomaly detection model is used to compute the likelihood of an input dataset containing malicious code and classify the input dataset based on the computed likelihood, for example, as described in connection with part 701 of FIG. 7.

FIG. 3 is a simple illustration of a method 300 for training a content anomaly detection model in accordance with some embodiments. As shown, at 302, a training dataset is received. In some embodiments, the training dataset can include one or more network data packets or data frames. In some embodiments, the training dataset can include one or more files that contain various types of data, such as text, graphic images, sound samples, video samples, computer-executable codes, various other suitable types of data, and/or one or more combinations thereof. In some embodiments, the training dataset can also include a stream of data in bytes, a stream of tokens, and a stream of various other suitable symbols or units in one or more communication sessions.

In some embodiments, the training dataset can be received from another site through a network, such as network 102. In some embodiments, it can be received from data structure 108, production server 110, shadow server 112, host-based detector 114, HEG analyzer 116, various other suitable sources, and one or more combinations thereof.

In some embodiments, the training dataset can be checked to ascertain its validity before it is used for training content anomaly detection models to ward off potential training attacks. Such a validation effort can also help avoid inadvertently immunizing one or more instances of malicious code from being detected. For example, a training dataset can be processed to determine whether it harbors any data that produces erroneous or otherwise unusual or invalid outcomes.

At 304, distinct n-grams of different sizes contained in the training dataset can be stored in a data structure, such as data structure 108, to form a model. In some embodiments, n-grams of different sizes can be generated by sliding windows of corresponding sizes over the training dataset and the distinct n-grams of different sizes contained in the training dataset can be stored when they are observed for the first time.

In some embodiments, hashed n-grams formed when the Bloom filter stores an n-gram can be cached to speed up the Bloom filter's check operations being used as part of a detection process, as described below in connection with data structure 108 in FIG. 1. This is advantageous because hash values can be looked up instead of being computed.

In some embodiments, a class of universal hash functions, such as H₃, can be used to reduce computational overhead associated with inserting and/or checking n-grams over a large amount of data. Given such universal hash functions, for example, re-computing hashes can be avoided when sliding n-grams windows and/or when using different window sizes. Suppose, for instance, that the hash of a 7-gram is needed and a 5-gram is hashed. The universal hash functions can hash an incremental 2-gram and combine it with the 5-gram hash value to generate a 7-gram hash.

In some embodiments, a detector, such as detector 106, can be used to generate the n-grams of different sizes and store the distinct n-grams. In some embodiments, an HEG analyzer 116 can be used to generate the n-grams of different sizes and store the distinct n-grams.

At 306, known-good new n-grams are received and a rate at which a new distinct n-gram is observed is computed. In some embodiments, detector 106 can be used to compute the new n-gram rate. In some embodiments, HEG analyzer 116 can be used to compute the new n-gram rate.

In some embodiments, new distinct n-grams that are observed over a time period can be used to compute the new n-gram rate. For example, the number of new distinct n-grams counted every 100 hours (or other period of time) can be used to compute the new n-gram rate. In some embodiments, new distinct n-grams that are observed from a number of data packets can be counted to compute the new n-gram rate. For example, a number of new distinct n-grams counted from every 1,000 data packets (or other number of data packets) can be used to compute the new n-gram rate.

At 308, it is determined whether further training of the content anomaly detection model is warranted using the new n-gram rate computed at 306. During the initial training period, it can be expected that many new distinct n-grams are observed. Over time, however, fewer distinct never-before-seen n-grams may be observed.

In some embodiments, a content anomaly detection model is deemed to have been sufficiently trained when the new n-gram rate becomes stable and low. If, for example, three consecutive new n-gram rates computed every 10,000 data packets are very close in value, a content anomaly detection model can be said to have been sufficiently trained in some embodiments. In some embodiments, a content anomaly detection model can also be said to have been sufficiently trained if four consecutive new n-gram rates computed every 30 days are very close in value. Various other metrics can be used additionally or alternatively to determine when the model is sufficiently trained.

If it is determined at 308 that further training is necessary, 306 and 308 can be repeated. If, however, it is determined at 310 that no further training is necessary, the content anomaly detection model can be deployed for detecting content anomalies of data traffic, such as data traffic 104.

FIG. 4 is a simple illustration of another method for generating and training a content anomaly detection model in accordance with some embodiments. As shown, at 402, known anomaly signatures are received. In some embodiments, the signature content of Snort rules from Sourcefire® and a collection of known virus samples are received. For example, such signatures can be purchased and/or downloaded from a trust-worthy web site, such as the one maintained by Sourcefire®.

In some embodiments, the anomaly signatures are stored in data structure 108. In some embodiments, it can be stored at detector 106, or HEG analyzer 116.

At 404, n-grams of different sizes are generated from the anomaly signatures. In some embodiments, as in 304 of FIG. 3 or 606 of FIG. 6, n-grams of different sizes can be generated by sliding windows of corresponding sizes over the content anomaly signatures.

At 406, the n-grams of different sizes generated in 404 are filtered to remove normal n-grams using a known-clean dataset. This may be necessary because the anomaly signatures may still have some normal n-grams. For example, an attack disguising as an HTTP request can still contain normal keywords, such as GET. In some embodiments, a Bloom filter containing known-clean datasets can be compared with the input dataset to identify normal n-grams. In some embodiments, the filtering operation is performed by detector 106.

At 408, distinct n-grams from the abnormal n-grams of different sizes are stored. In some embodiments, a Bloom filter can be used to store the distinct n-grams of different sizes. Instead of using n bytes to represent an n-gram, for example, a Bloom filter can store an n-gram using just few bits. For instance, a 24-bit Bloom filter is capable of holding 2²⁴/N_(h) elements, where N_(h) represents the number of hash functions used.

At 410, it is determined whether the content anomaly detection model needs to be updated. In some embodiments, the content anomaly model can be updated incrementally following one or more releases of new anomaly signatures due to identifications of new viruses and/or an update of the Snort rules. If it is determined that the content anomaly model needs to be updated, 402, 404, 406, and 408 can be repeated.

In some embodiments, training datasets are scrutinized using the content anomaly detection model. For example, n-grams in the training datasets matching the content anomaly detection model can be dropped. In some embodiments, an entire data packet can be dropped if the packet contains too many n-grams that match the content anomaly detection model. In some embodiments, a 5% (or other percent threshold) bad n-gram threshold is used to determine whether to drop an entire packet out of the training datasets.

In some embodiments, if a never-before-seen n-gram with respect to both the good and bad content anomaly detection model appear, its detection score is further weighted by a factor of 5 (or other factors) over other malicious n-grams. This enables further separation of malicious packets from normal ones in order to achieve higher detection accuracy.

FIG. 5 is a simple illustration of a method for sharing content anomaly detection models in accordance with some embodiments. As shown, at 502, a trained binary-based detection model is shared. The models may be distributed from one detector to another using email, ftp, http, and/or various other suitable mechanisms.

In some embodiments, Bloom filters are used to provide mechanism for sharing n-grams generated from potentially malicious code among multiple sites. Bloom filters are capable of preserving privacy of traffic content of each site because Bloom filters share signature information with little risk of revealing content information. For example, a Bloom filter can confirm the presence/absence of an n-gram with little risk of disclosing the original n-gram.

In some embodiments, a single Bloom filter contains n-grams associated with more than one type of potentially malicious code to reduce memory overhead further than if separate Bloom filters were used. This also enables a reduction in the computational overhead. For example, by holding multiple types of potentially malicious code in a single Bloom filter, the common n-grams that are shared between different types of potentially malicious code are stored only once, reducing memory overhead when compared to storing duplicate copies of identical n-grams.

In some embodiments, a Bloom filter is compressed before it is transmitted for efficient transmission. For example, Bloom filters can be compressed using LZW compression algorithm before they are transmitted to remote sites.

At 504, the content of a local model is compared with the content of a shared model from a remote site. In some embodiments, the contents of the local model and the shared model are compared by using a bitwise AND operation. In some embodiments, a similarity score between the local model and each of the shared models is computed. In some embodiments, the similarity score is computed using the following formula:

${{Score} = {2 \star \frac{N_{c}}{\left( {N_{1} + N_{2}} \right)}}},$ where N_(c) is the number of common n-grams and N_(i) the number of suspicious n-grams in alert i. If a Bloom filter is used, a count of items in the filter is be kept in some embodiments. In some embodiments, the count is estimated by N_(b)/N_(h), where N_(b) is the number of bits set in the filter and N_(h) is the number of hash function used by the filter.

A higher score implies that the local model and a shared model have many common n-grams. In some embodiments, the more commonly observed n-grams are given more weight for determining the likelihood of being a part of an instance of malicious code.

At 506, the local model is updated using each of the shared models. In one embodiments, one or more shared models from remote sites are merged into the local model. For example, the content of the shared model from the remote site can be merged into the content of the local model by performing a bitwise OR operation on the pair of models. This is advantageous because the local model can learn the signature of a new type of malicious code before confronting an instance of the new malicious code.

FIG. 6 is a simple illustration of a method 600 for detecting content anomalies in accordance with some embodiments. As shown, at 602, an input dataset, or a portion thereof, is received. As in 302 for the training dataset, the input dataset can be network data packets or frames, files containing data in variety of types and formats, or a stream of bytes or tokens of different lengths. In some embodiments, the input dataset can be data traffic, such as data traffic 104.

In some embodiments, the input dataset can be a test dataset that is designed to measure how well a content anomaly detection model is trained. In some embodiments, the input dataset can be a stream of incoming bytes that should be scrutinized before reaching its destinations.

At 604, n-grams of different sizes are generated from the input dataset. In some embodiments, as in 304, n-grams of different sizes can be generated by sliding windows of corresponding sizes over the input dataset.

At 606, the number of distinct n-grams of different sizes in the input dataset that are not found in the training dataset are counted. In some embodiments, a counter is incremented when a distinct n-gram is observed for the first time by checking a Bloom filter that was previously trained with known-good n-grams to see if the distinct n-gram has seen in the training dataset. In some embodiments, the number of distinct n-grams is counted at the content anomaly detector. In some embodiment, it can be counted at the HEG analyzer.

At 608, an anomaly score for the input dataset is computed using the number of distinct n-grams counted in 606. In some embodiments, the anomaly score is computed using the following formula:

${{{Anomaly}\mspace{14mu}{Score}} = \frac{N}{T}},$ where T is the total number of n-grams in the input dataset and N is the number of new distinct n-grams not found in the training dataset. The higher the anomaly score, the more likely that the input dataset contains an instance of malicious code.

In some embodiments, the anomaly score can be calculated at the content anomaly detector. In some embodiments, it can be computed at the HEG analyzer.

At 610, the anomaly score can be used to determine whether the input dataset is anomalies. In some embodiments, if the input dataset generates an anomaly score above a threshold value, it can be used to generate content anomaly signatures. In some embodiments, for example, different sizes of n-grams can be generated by sliding windows of corresponding sizes over the input data. In some embodiments, the n-grams of different sizes are filtered to remove normal n-grams using a known-clean dataset, as described above in connection with 406 of FIG. 4.

FIG. 7 is a simple illustration of another method 700 for training and detecting content anomalies in accordance with some embodiments. As shown, at 702, an input dataset is classified. In some embodiments, content anomaly detector 106 can act as a network anomaly flow classifier to determine whether the input dataset contains instances of malicious code. Detector 106 classifies the data traffic and directs it to an appropriate server, such as production server 110 or shadow server 112.

At 704, the likelihood of the input dataset containing malicious n-grams is determined. In some embodiments, the likelihood of the input dataset containing malicious n-grams based on anomaly scores, which can be computed as discussed above in connection with 608, is determined.

If it is determined at 704 that the likelihood of the input dataset containing malicious n-grams is low, the input dataset is further processed at 706. In some embodiments, an input dataset, such as data traffic 104, that is determined not to contain malicious n-grams can be sent to a production server, such as production server 110, to be processed further.

If, however, it is determined at 704 that the likelihood of the input dataset containing malicious n-grams is above a threshold, the input dataset can be flagged and sent at 708 to a non-production server that runs an additional content anomaly detector. In some embodiments, an input dataset, such as data traffic 104, that is deemed likely to contain malicious n-grams is sent to host-based detector 114 that can be part of, or attached to, a shadow server, such as shadow server 112. The host-based detector can employ more sophisticated techniques that require more processing time and computational overhead to examine the input dataset that is sent from detector 106.

At 710, it is determined whether the flagged input dataset contains malicious n-grams. In some embodiments, the host-based detector examines the flagged input dataset and determine whether to process it further or to drop it.

If it is determined at 710 that the flagged input dataset contains malicious n-grains, the flagged dataset can be dropped or isolated at 716. In some embodiments, the host-based detector can be used to isolate the input dataset.

At 718, the isolated dataset is used to generate content anomalous signatures. In some embodiments, the host-based detector can generate new content anomaly signatures and feed it back to the classifier for further training of its content anomaly detection model, as described above in connection with FIG. 4.

If, however, it is determined at 710 that the flagged input dataset is unlikely to contain malicious n-grams, the input dataset can be processed further at 712. In some embodiments, the host-based detector can send the input dataset to the shadow server for further processing. For example, in some embodiments, the shadow server processes the input dataset in a protected environment, such as a sandbox, and monitors the state change of, the sandbox. In some embodiments, the sandbox is implemented using an emulator or a virtual machine.

At 714, the content anomaly detection model is updated to include the n-grams contained in the flagged input dataset, as described above in connection with 302 and 304 of FIG. 3. This may prevent them from causing false positives again in the future, thereby reducing the false positive rate of the content anomaly detection model. In some embodiments, the host-based detector can provide feedback necessary for the classifier to update its content anomaly detection model.

Although the invention has been described and illustrated in the foregoing illustrative embodiments, it is understood that the present disclosure has been made only by way of example, and that numerous changes in the details of implementation of the invention can be made without departing from the spirit and scope of the invention, which is only limited by the claims which follow. Features of the disclosed embodiments can be combined and rearranged in various ways. 

What is claimed is:
 1. A method for outputting data based on anomaly detection, comprising: receiving, using a hardware processor, a known-good dataset; storing, using the hardware processor, distinct n-grams from the known-good dataset to form a binary anomaly detection model; receiving, using the hardware processor, known-good new n-grams; computing, using the hardware processor, a rate of receipt of distinct n-grams in the new n-grams; determining, using the hardware processor, whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; using the binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; and outputting, using the hardware processor, the input dataset based on whether the input dataset contains an anomaly.
 2. The method of claim 1, wherein the binary detection model is represented using a Bloom filter.
 3. The method of claim 1, wherein the rate of receipt of distinct n-grams is based on how many distinct n-grams are received in a given time period.
 4. The method of claim 1, wherein the rate of receipt of distinct n-grams is based on how many distinct n-grams are received in a given volume of data.
 5. A method for outputting data based on anomaly detection, comprising: receiving known anomaly signatures; generating, using a hardware processor, n-grams of different sizes using the known anomaly signatures; storing, using the hardware processor, abnormal n-grams in the n-grams of different sizes in a binary anomaly detection model; using the binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; and outputting, using the hardware processor, the input dataset based on whether the input dataset contains an anomaly.
 6. The method of claim 5, wherein the anomaly signatures include Snort rules.
 7. The method of claim 5, wherein the binary anomaly detection model is represented using a Bloom filter.
 8. A method for outputting data based on anomaly detection, comprising: receiving a shared binary anomaly detection model; comparing, using a hardware processor, the shared binary anomaly detection model with a local anomaly detection model; combining, using the hardware processor, the shared binary anomaly detection model with the local anomaly detection model to form a new binary anomaly detection model; using the new binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the new binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the new binary anomaly detection model for an n-gram in the input dataset; and outputting, using the hardware processor, the input dataset based on whether input dataset contains an anomaly.
 9. The method of claim 8, wherein the shared binary anomaly detection model is represented using a Bloom filter.
 10. The method of claim 8, wherein the local binary anomaly detection model is represented using a Bloom filter.
 11. The method of claim 8, wherein the comparing is performed using a bitwise AND operation.
 12. The method of claim 8, wherein the combining is performed using a bitwise OR operation.
 13. A method for outputting data based on anomaly detection, comprising: receiving an input dataset; generating, using a hardware processor, n-grams of different sizes from the input dataset; counting, using the hardware processor, the number of distinct n-grams in the n-grams of different sizes that are not present in a binary anomaly detection model; computing, using the hardware processor, an anomaly score based upon the number of distinct n-grams and a total count of the n-grams in the input dataset; using the anomaly score to determine whether an input dataset contains an anomaly; and outputting, using the hardware processor, the input dataset based on whether the input dataset contains an anomaly.
 14. The method of thin 13, wherein the binary anomaly detection model represented using a Bloom filter.
 15. The method of claim 13, wherein the n-grams of different sizes are generated using a window applied to the input dataset.
 16. The method of claim 13, wherein the anomaly score is compared to a threshold level to determine whether the input dataset contains an anomaly.
 17. A method for outputting data based on anomaly detection, comprising: receive, using a hardware processor, an input dataset; using a binary anomaly detection model to determine whether an input dataset is likely to contain an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset is likely to contain an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; if the input dataset is determined to be likely to contain an anomaly, dropping, using the hardware processor, the input dataset; and if the input dataset is determined to be unlikely to contain an anomaly, outputting, using the hardware processor, the input dataset based on whether the input dataset contains an anomaly.
 18. The method of claim 17, wherein the binary anomaly detection model is represented using a Bloom filter.
 19. The method of claim 17, further comprising: determining whether the input dataset contains malicious n-grams; and if the input dataset is determined to not contain malicious n-grams, using the input dataset to perform a function related to the input dataset.
 20. The method of claim 17, further comprising generating a content anomaly signature using the input dataset.
 21. The method of claim 19, further comprising updating the binary anomaly detection model using the input dataset.
 22. A non-transitory computer-readable medium containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, the method comprising: receiving a known-good dataset; storing distinct n-grams from the known-good dataset to form a binary anomaly detection model; receiving known-good new n-grams; computing a rate of receipt of distinct n-grams in the new n-grams; determining whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; using the binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; and outputting the input dataset based on whether the input dataset contains an anomaly.
 23. The medium of claim 22, wherein the binary detection model is represented using a Bloom filter.
 24. The medium of claim 22, wherein the rate of receipt of distinct n-grams is based on how many distinct n-grams are received in a given time period.
 25. The medium of claim 22, wherein the rate of receipt of distinct n-grams is based on how many distinct, n-grams are received in a given volume of data.
 26. A non-transitory computer-readable medium containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, the method comprising: receiving known anomaly signatures; generating n-grams of different sizes using the known anomaly signatures; storing abnormal n-grams in the n-grams of different sizes in a binary anomaly detection model; using the binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; and outputting the input dataset based on whether the input dataset contains an anomaly.
 27. The medium of claim 26, wherein the anomaly signatures include Snort rules.
 28. The medium of claim 26, wherein the binary anomaly detection model is represented using a Bloom filter.
 29. A non-transitory computer-readable medium containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, the method comprising: receiving a shared binary anomaly detection model; comparing the shared binary anomaly detection model with a local anomaly detection model; combining the shared binary anomaly detection model with the local anomaly detection model to form a new binary anomaly detection model; using the new binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the new binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the new binary anomaly detection model for an n-gram in the input dataset; and outputting the input dataset based on whether the input dataset contains an anomaly.
 30. The medium of claim 29, wherein the shared binary anomaly detection model is represented using a Bloom filter.
 31. The medium of claim 29, wherein the local binary anomaly detection model is represented using a Bloom filter.
 32. The medium of claim 29, wherein the comparing is performed using a bitwise AND operation.
 33. The medium claim 29, wherein the combining is performed using a bitwise OR operation.
 34. A non-transitory computer-readable medium containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, the method comprising: receiving an input dataset; generating n-grams of different sizes from the input dataset; counting the number of distinct n-grams in the n-grams of different sizes that are not present in a binary anomaly detection model; computing an anomaly score based upon the number of distinct n-grams and a total count of the n-grams in the input dataset; using the anomaly score to determine whether an input dataset contains an anomaly; and outputting the input dataset based on whether the input dataset contains an anomaly.
 35. The medium of claim 34, wherein the binary anomaly detection model is represented using a Bloom filter.
 36. The medium of claim 34, wherein the n-grams of different sizes are generated using a window applied to the input dataset.
 37. The medium of claim 34, wherein the anomaly score is compared to a threshold level to determine whether the input dataset contains an anomaly.
 38. A non-transitory computer-readable medium containing computer-executable instructions that, when executed by a processor, cause the processor to perform a method for outputting data based on anomaly detection, the method comprising: receiving an input dataset; using a binary anomaly detection model to determine whether an input dataset is likely to contain an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset is likely to contain an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; if the input dataset is determined to be likely to contain an anomaly, dropping the input dataset; and if the input dataset is determined to be unlikely to contain an anomaly, outputting the input dataset based on whether the input dataset contains an anomaly.
 39. The medium of claim 38, wherein the binary anomaly detection model is represented using a Bloom filter.
 40. The medium of claim 38, the method further comprising: determining whether the input dataset contains malicious n-grams; and if the input dataset is determined to not contain malicious n-grams, using the input dataset to perform a function related to the input dataset.
 41. The medium of claim 38, the method further comprising generating a content anomaly signature using the input dataset.
 42. The medium of claim 40, the method further comprising updating the binary anomaly detection model using the input dataset.
 43. A system for outputting data based on anomaly detection, comprising: digital processing device that: receives a known-good dataset; stores distinct n-grams from the known-good dataset to form a binary anomaly detection model; receives known-good new n-grams; computes a rate of receipt of distinct n-grams in the new n-grams; determines whether further training of the anomaly detection model is necessary based on the rate of receipt on distinct n-grams; uses the binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; and outputs the input dataset based on whether the input dataset contains an anomaly.
 44. The system of claim 43, wherein the binary detection model is represented using a Bloom filter.
 45. The system of claim 43, wherein the rate of receipt of distinct n-grams is based on how many distinct n-grams are received in a given time period.
 46. The system of claim 43, wherein the rate of receipt of distinct n-grams is based on how many distinct n-grams are received in a given volume of data.
 47. A system for outputting data based on anomaly detection, comprising: a digital processing device that: receives known anomaly signatures; generates n-grams of different sizes using the known anomaly signatures; stores abnormal n-grams in the n-grams of different sizes in a binary anomaly detection model; uses the binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset contains an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; and outputs the input dataset based on whether the input dataset contains an anomaly.
 48. The system of claim 47, wherein the anomaly signatures include Snort rules.
 49. The system of claim 47, wherein the binary anomaly detection model is represented using a Bloom filter.
 50. A system for outputting data based on anomaly detection, comprising: a digital processing device that: receives a shared binary anomaly detection model; compares the shared binary anomaly detection model with a local anomaly detection model; combines the shared binary anomaly detection model with the local anomaly detection model to form a new binary anomaly detection model; uses the new binary anomaly detection model to determine whether an input dataset contains an anomaly, wherein the new binary anomaly detection model is used to determine whether the mint dataset contains an anomaly by checking the new binary anomaly detection model for an n-gram in the input dataset; and outputs the input dataset based on whether the input dataset contains an anomaly.
 51. The system of claim 50, wherein the shared binary anomaly detection model is represented using a Bloom filter.
 52. The system of claim 50, wherein the local binary anomaly detection model is represented using a Bloom filter.
 53. The system of claim 50, wherein the comparing is performed using a bitwise AND operation.
 54. The system of claim 50, wherein the combining is performed using a bitwise OR operation.
 55. A system for outputting data based on anomaly detection, comprising: a digital processing device that: receives an input dataset; generates n-grams of different sizes from the input dataset; counts the number of distinct n-grams in the n-grams of different sizes that are not present in a binary anomaly detection model; computes an anomaly score based upon the number of distinct n-grams and a total count of the n-grams in the input dataset; uses the anomaly score to determine whether an input dataset contains an anomaly; and outputs the input dataset based on whether the input dataset contains an anomaly.
 56. The system of claim 55, wherein the binary anomaly detection model is represented using a Bloom filter.
 57. The system of claim 55, wherein the n-grams of different sizes are generated using a window applied to the input dataset.
 58. The system of claim 55, wherein the anomaly score is compared to a threshold level to determine whether the input dataset contains an anomaly.
 59. A system for outputting data based on anomaly detection, comprising: a digital processing device that: receives an input dataset; uses a binary anomaly detection model to determine whether an input dataset is likely to contain an anomaly, wherein the binary anomaly detection model is used to determine whether the input dataset is likely to contain an anomaly by checking the binary anomaly detection model for an n-gram in the input dataset; if the input dataset is determined to be likely to contain an anomaly, drops the input dataset; and if the input dataset is determined to be unlikely to contain an anomaly, outputs the input dataset based on whether the input dataset contains an anomaly.
 60. The system of claim 59, wherein the binary anomaly detection model is represented using a Bloom filter.
 61. The system of claim 59, wherein the digital processing device also: determines whether the input dataset contains malicious n-grams; and if the input dataset is determined to not contain malicious n-grams, uses the input dataset to perform a function related to the input dataset.
 62. The system of claim 59, wherein the digital processing device also generates a content anomaly signature using the input dataset.
 63. The system of claim 61, wherein the digital processing device also updates the binary anomaly detection model using the input dataset. 